/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package PacketHandling;

import horizon.entity.Entity;
import horizon.map.Chunk;
import horizon.map.Map;
import horizon.map.Tile;
import java.util.ArrayList;

/**
 *
 * @author J_Laptop
 */
public class MapDecoder {
    
    public static Map createMap(ArrayList<Chunk> map , ArrayList<Entity> entities){
        Map m = new Map();
        
        for(Chunk c : map){
            
            m.addChunk(c, c.worldPosition);
            for(Tile t : c.tiles){
                
                m.addEntity(t);
                
            }
        }
        if(entities != null){
            
            for(Entity e : entities){

                m.addEntity(e);

            }
            
        }
        
        return m;
    }
}
